package com.jingzhi.count.entity;

import com.fasterxml.jackson.annotation.JsonInclude;

/**
 * 作者： 张恒同
 * 时间：2018/3/23   14:45
 * 描述  统一回调类
 */
public class MyResponse<T> {
    public static final int SUCCESS = 0;
    public static final int ERROR = -1;

    int rc;
    String des;
    @JsonInclude(JsonInclude.Include.NON_NULL)
    T data;

    public int getRc() {
        return rc;
    }

    public void setRc(int rc) {
        this.rc = rc;
    }

    public String getDes() {
        return des;
    }

    public void setDes(String des) {
        this.des = des;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public void isSuccess(String msg) {
        this.setRc(MyResponse.SUCCESS);
        this.setDes(msg);

    }

    public void isError(String msg) {
        this.setRc(MyResponse.ERROR);
        this.setDes(msg);
    }
}
